package com.yzh.design.demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class AuthController {
    private SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public AuthInfo doAuth(String uId, String orderId, Date authDate) throws ParseException {
        //三级审批
        Date date = AuthService.queryAuthInfo("10003", orderId);
        if (date == null) return new AuthInfo("0001", "单号：" + orderId, " 状态：待审批 ", "负责人：王组长");

        //二级审批
        Date date2 = AuthService.queryAuthInfo("10002", orderId);
        if (date2 == null) return new AuthInfo("0001", "单号：" + orderId, " 状态：待审批 ", "负责人：李经理");

        //一级审批
        Date date3 = AuthService.queryAuthInfo("10001", orderId);
        if (date3 == null) return new AuthInfo("0001", "单号：" + orderId, " 状态：待审批 ", "负责人：杨总");

        return new AuthInfo("0000", "单号：" + orderId, " 状态：审批完成");
    }
}
